<template>
  <Model
    :title="row.edit ? '编辑' : '添加'"
    :width="800"
    :show="show"
    @confirm="confirm"
    @cancel="cancel"
  >
    <Form slot="form">
      <FormDoubleItem :labels="['学生id']">
        <a-input
          slot="left"
          v-model="row.studentId"
          placeholder="请输入学生id"
        />
        <!--      <a-input-->
        <!--          slot="right"-->
        <!--          v-model="row.name"-->
        <!--          placeholder="请输入学生姓名"-->
        <!--      />-->
      </FormDoubleItem>

      <FormDoubleItem :labels="['是否对口', '是否被录取']">
        <a-select
          slot="left"
          show-search
          v-model="row.suitable"
          option-filter-prop="children"
          style="width: 100%"
          @change="TypeChanges"
          placeholder="是否显示"
        >
          <a-select-option value="0">不对口</a-select-option>
          <a-select-option value="1">对口</a-select-option>
        </a-select>
        <a-select
          slot="right"
          show-search
          v-model="row.success"
          option-filter-prop="children"
          style="width: 100%"
          @change="TypeChanges"
          placeholder="是否显示"
        >
          <a-select-option value="0">不录取</a-select-option>
          <a-select-option value="1">录取</a-select-option>
        </a-select>
      </FormDoubleItem>

      <FormDoubleItem :labels="['公司名称', '报名岗位']">
        <a-input slot="left" v-model="row.company" placeholder="公司名称" />
        <a-input slot="right" v-model="row.job" placeholder="岗位" />
      </FormDoubleItem>
    </Form>
  </Model>
</template>

<script>
import Model from "@/components/common/model/Model";
import Form from "@/components/common/form/Form";
import FormItem from "@/components/common/form/formItem/FormItem";
import FormLenItem from "components/common/form/formItem/FormLenItem";
import FormDoubleItem from "components/common/form/formDoubleItem/FormDoubleItem";
import {
  check,
  newsType,
  newsStatus,
  years,
  matchType,
} from "@/assets/data/other";
import { hasPropertyEmpty } from "common/index";
import moment from "moment";
export default {
  components: {
    Model,
    Form,
    FormDoubleItem,
    FormLenItem,
    FormItem,
    years,
    matchType,
  },
  props: {
    row: {
      type: Object,
      default() {
        return {};
      },
    },
    show: {
      type: Boolean,
      defalut: false,
    },
  },
  data() {
    return {
      check,
      newsType,
      newsStatus,
      moment,
      years,
      matchType,
    };
  },
  created() {
    this.init();
  },
  methods: {
    init() {
      console.log(row);
    },
    beforeUpload(file) {
      this.row.file = [file];
      return false;
    },
    handleRemove(file) {
      const index = this.row.file.indexOf(file);
      const newFileList = this.row.file.slice();
      newFileList.splice(index, 1);
      this.row.file = newFileList;
    },
    confirm() {
      const row = this.row;
      console.log(row);
      row.suitable == "对口"
        ? (row.suitable = 1)
        : row.suitable == "不对口"
        ? (row.suitable = 0)
        : row.suitable;
      this.$emit("confirm", {
        ...row,
      });
      this.row = null;
    },
    cancel() {
      this.$emit("cancel");
    },
    Changes(value) {
      this.$forceUpdate();
    },
    TypeChanges(value) {
      this.$forceUpdate();
    },
  },
};
</script>

<style lang="less" scoped>
.t-form {
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-items: center;
  padding-right: 30px;
  .ant-btn {
    width: 145.5px !important;
  }
}
</style>
